<!DOCTYPE html>
<html ng-app="memberUpdate" ng-cloak>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/lib/fontAwesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="/lib/navbar/css/responsive-menu.css" rel="stylesheet">
    <link href="/lib/bootstrap-datetime/css/jquery.datetimepicker.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" type="text/css" href="/lib/angular-ui-grid/ui-grid.css"/>
    <link rel="stylesheet" type="text/css" href="/lib/angular-toastr/dist/angular-toastr.css"/>
    <link rel="stylesheet" href="/lib/angular-ui-select/dist/select.css">
    <link rel="stylesheet" href="/lib/jquery-ui/jquery-ui.min.css">
    <link href="/css/style.css" rel="stylesheet">

    <script src="/lib/jquery/jquery.min.js"></script>
    <script src="/lib/jquery/jquery.cookie.min.js"></script>
    <script src="/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="/lib/navbar/js/modernizr.min.js" type="text/javascript"></script>
    <script src="/lib/navbar/js/modernizr-custom.js" type="text/javascript"></script>
    <script src="/lib/navbar/js/responsive-menu.js" type="text/javascript"></script>
    <script src="/lib/angular/angular.js"></script>
    <script src="/lib/angular-toastr/dist/angular-toastr.tpls.js"></script>
    <script src="/lib/angular-ui-select/dist/select.js"></script>
    <script src="/lib/angular-ui-grid/ui-grid.min.js"></script>
    <script src="/lib/jquery-ui/jquery-ui.min.js"></script>
    <script src="/js/grid-pagination.js"></script>
    <script src="/js/directives.js"></script>
    <script src="/lib/bootstrap-datetime/js/jquery.datetimepicker.js"></script>
    <script src="/js/memberUpdateController.js"></script>

    <title>用户管理</title>
</head>

<body ng-controller="memberUpdateController">
<% var dynamicWidth = '9'; %>
<% include navbar %>
<div class="col-md-12 form-group" style="margin-top:10px;">
    <span style="display: none;" id="uid"><%- member.u_id %></span>
    <% var operation = 'add'; %>
    <div class="search-area big-panel-container">

        <% if(typeof list !== 'undefined') { operation = 'batchAdd'; %>
        <div class="col-md-3 ">
            <div class="col-md-11 kick-padding-margin">
                <input type="hidden" id="operation" value="batchAdd">

                <h2 class="group-head"><span>已添加用户</span></h2>
            </div>
            <div class="col-md-11">
                <ul class="list-group" id="uList">
                    <li class="list-group-item active" id="p-list-1" ng-click="editList(1)"><i
                                style="color:red;float:left">&nbsp;&nbsp;*</i>
                        <i class="fa fa-trash-o remove-icon"></i>&nbsp;<span ng-bind="addList[1].u_name"></span></li>
                    </li>
                </ul>
                <button ng-click="saveAll()" class="btn btn-success btn-sm col-md-12"><i class="fa fa-save"></i>&nbsp;&nbsp;保存全部
                </button>
            </div>
        </div>
        <% } else { dynamicWidth = '10 col-md-offset-1'; %>
        <% if (member.username) {
            operation = "update";
        } %>
        <input type="hidden" id="operation" value="adminUpdate">
        <% } %>
        <div class="col-md-<%- dynamicWidth %> big-panel">
            <div class="col-md-12 kick-padding-margin">
                <% if(operation == "update") { %>
                <h2 class="group-head"><span>编辑用户</span></h2>
                <% } else { %>
                <h2 class="group-head"><span>注册用户</span></h2>
                <% } %>
            </div>
            <div class="form-group col-md-10 col-md-offset-1">
                <label class="search-label">用户姓名</label>
                <input type="text" class="form-control" id="u_name" ng-model="query.u_name"
                       <% if(operation === 'update') { %>disabled
                        <% } %>
                       value="<%- member.u_name %>"/>
            </div>

            <div class="form-group col-md-10 col-md-offset-1">
                <label class="search-label">登录账号</label>
                <input type="text" class="form-control" id="username" ng-model="query.username"
                       <% if(operation === 'update') { %>disabled
                        <% } %>
                       value="<%- member.username %>"/>
            </div>

            <div class="form-group col-md-10 col-md-offset-1">
                <label class="search-label">邮箱</label>
                <input type="text" class="form-control" id="email" ng-model="query.email"
                       value="<%- member.email %>"/>
            </div>

            <input type="hidden" value="<%- member.role %>" id="role">
            <% if(operation != 'update') { %>
            <div class="form-group col-md-10 col-md-offset-1 margin-top-20">
                <label class="search-label">是否是实习生</label>
                <input type="checkbox" style="margin-left: 25px;transform: scale(1.5,1.5)" ng-model="query.isIntern"
                       ng-change="changeRole()"/>
            </div>
            <% } %>
            <div class="form-group col-md-10 col-md-offset-1 margin-top-20">
                <label class="search-label">登陆密码</label>
                <% if(!member.username){ %>
                <input style="display:none">
                <input type="password" class="form-control pwd" id="password" autocomplete="off" ng-model="query.pwd"
                       value="" placeholder="默认密码: iflytek 如需修改请输入"/>
                <% } else { %>
                <input style="display:none">
                <input type="password" class="form-control pwd" id="password" autocomplete="off" ng-model="query.pwd"
                       value="" placeholder="请谨慎修改,否则将导致用户无法登陆"/>
                <% } %>

            </div>

            <div class="col-md-12">
                <% if(typeof list !== 'undefined') { %>
                <button class="col-md-2 col-md-offset-1 btn btn-warning margin-top-20" ng-click="back()"
                        style="margin-right: 25px;"><i class="fa fa-backward"></i>&nbsp;&nbsp;返回
                </button>
                <% } else if(!member.username) { %>
                <button class="col-md-2 col-md-offset-3 pull-right btn btn-danger margin-top-20" ng-click="closeModal()"
                        style="margin-right: 15px;"><i class="fa fa-repeat"></i>&nbsp;&nbsp;关闭
                </button>
                <% } else { %>
                <button class="col-md-2 col-md-offset-3 btn btn-warning margin-top-20" ng-click="back()"
                        style="margin-right: 15px;"><i class="fa fa-backward"></i>&nbsp;&nbsp;返回
                </button>
                <% } %>
                <% if(typeof list !== 'undefined') { %>
                <button class="col-md-2 btn btn-primary col-md-offset-1 margin-top-20" style="margin-right:25px"
                        ng-click="add()">
                    <i class="fa fa-plus"></i>&nbsp;&nbsp;添加一项
                </button>
                <button class="col-md-2 btn btn-info  col-md-offset-1 margin-top-20" style="margin-right:25px"
                        ng-click="remove()">
                    <i class="fa fa-minus"></i>&nbsp;&nbsp;移除此项
                </button>
                <% } else if(!member.username) { %>
                <button class="col-md-2 col-md-offset-1 pull-right btn btn-primary margin-lr margin-top-20"
                        ng-click="save()">
                    <i class="fa fa-save"></i>&nbsp;&nbsp;保存
                </button>
                <% } else { %>
                <button class="col-md-2 col-md-offset-1 btn btn-primary margin-top-20" ng-click="save()">
                    <i class="fa fa-save"></i>&nbsp;&nbsp;保存
                </button>
                <% } %>
            </div>
        </div>
    </div>

    <div class="modal fade  remove-mem" style="position: absolute;top:40px;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">确认移除该用户？</h4>
                </div>
                <div class="modal-body" style="height: 70px;">
                    <button type="button" class="btn btn-success col-md-2 pull-right" id="ensure-remove">确认</button>
                    <button type="button" class="btn btn-warning col-md-2 pull-right" style="margin-right: 20px"
                            data-dismiss="modal">取消
                    </button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

</div>
<script>
    $(function ($) {
        var menu = $('.rm-nav').rMenu({
            minWidth: '960px'
        });
    });
    <% if (!member.username) { %>
    $(".rm-container").remove();
    $("body").css("margin-top", "20px");
    <% } %>
</script>
</body>
</html>